package com.jic.page;


import com.jic.tuple.Tuple;

import java.io.Serializable;
import java.util.List;
/**
 * description: PageRet
 * date: 2020-01-10 11:58
 * author: wangys
 * version: 1.0
 */
public class PageRet implements Serializable {
    private static final long serialVersionUID = -5001097800883173568L;
    private int pageNo;
    private int pageSize;
    private long totalCount;
    private List<Tuple<String, String>> orderBys;

    public PageRet(Page page) {
        if (page != null) {
            this.pageNo = page.getPageNo();
            this.pageSize = page.getPageSize();
            this.orderBys = page.getOrderBys();
        }

    }

    public PageRet(Page page, long totalCount) {
        this(page);
        this.totalCount = totalCount;
    }

    public int getPageNo() {
        return this.pageNo;
    }

    public int getPageSize() {
        return this.pageSize;
    }

    public long getTotalCount() {
        return this.totalCount;
    }

    public List<Tuple<String, String>> getOrderBys() {
        return this.orderBys;
    }

    public PageRet setPageNo(int pageNo) {
        this.pageNo = pageNo;
        return this;
    }

    public PageRet setPageSize(int pageSize) {
        this.pageSize = pageSize;
        return this;
    }

    public PageRet setTotalCount(long totalCount) {
        this.totalCount = totalCount;
        return this;
    }

    public PageRet setOrderBys(List<Tuple<String, String>> orderBys) {
        this.orderBys = orderBys;
        return this;
    }

    public boolean equals(Object o) {
        if (o == this) {
            return true;
        } else if (!(o instanceof PageRet)) {
            return false;
        } else {
            PageRet other = (PageRet)o;
            if (!other.canEqual(this)) {
                return false;
            } else if (this.getPageNo() != other.getPageNo()) {
                return false;
            } else if (this.getPageSize() != other.getPageSize()) {
                return false;
            } else if (this.getTotalCount() != other.getTotalCount()) {
                return false;
            } else {
                Object this$orderBys = this.getOrderBys();
                Object other$orderBys = other.getOrderBys();
                if (this$orderBys == null) {
                    if (other$orderBys != null) {
                        return false;
                    }
                } else if (!this$orderBys.equals(other$orderBys)) {
                    return false;
                }

                return true;
            }
        }
    }

    protected boolean canEqual(Object other) {
        return other instanceof PageRet;
    }

    public int hashCode() {
        int PRIME = 1;
        int result = 1;
        result = result * 59 + this.getPageNo();
        result = result * 59 + this.getPageSize();
        long $totalCount = this.getTotalCount();
        result = result * 59 + (int)($totalCount >>> 32 ^ $totalCount);
        Object $orderBys = this.getOrderBys();
        result = result * 59 + ($orderBys == null ? 43 : $orderBys.hashCode());
        return result;
    }

    public String toString() {
        return "PageRet(pageNo=" + this.getPageNo() + ", pageSize=" + this.getPageSize() + ", totalCount=" + this.getTotalCount() + ", orderBys=" + this.getOrderBys() + ")";
    }

    public PageRet() {
    }
}
